#include "headfile.h"

#define DATA 26
#define MONTH RTC_Month_October
#define WEEKDAY RTC_Weekday_Saturday

#define HOUR 17
#define MIN 47
#define SEC 40

void RTC__Init(void)
{
	RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR,ENABLE);
	PWR_BackupAccessCmd(ENABLE);
	RCC_RTCCLKConfig(RCC_RTCCLKSource_LSE);
	RCC_RTCCLKCmd(ENABLE);
	

	RTC_InitTypeDef RTC_Struct;
	RTC_Struct.RTC_AsynchPrediv = 0x7F;
	RTC_Struct.RTC_HourFormat = RTC_HourFormat_24;
	RTC_Struct.RTC_SynchPrediv = 0xFF;
	
	RTC_Init(&RTC_Struct);
	
	RTC_DateTypeDef RTC_Date_Struct;
	RTC_Date_Struct.RTC_Date = DATA;
	RTC_Date_Struct.RTC_Month = MONTH;
	RTC_Date_Struct.RTC_WeekDay = WEEKDAY;
	RTC_SetDate(RTC_Format_BIN, &RTC_Date_Struct);
	
	RTC_TimeTypeDef RTC_Time_Struct;
	RTC_Time_Struct.RTC_Hours = HOUR;
	RTC_Time_Struct.RTC_Minutes = MIN;
	RTC_Time_Struct.RTC_Seconds = SEC;
	RTC_Time_Struct.RTC_H12 = RTC_H12_AM;
	RTC_SetTime(RTC_Format_BIN, &RTC_Time_Struct);
}
